<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.mytrip.model.Userinfo"
	import="com.mytrip.webapp.filter.CtxSessionBag"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type='text/javascript'
	src='<%=request.getContextPath() %>/js/password_strength.js'></script>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>出发吧</title>
		<jsp:include page="/common/include_js.jsp" />
		<link rel="stylesheet" type="text/css" media="screen"
			href="<%=request.getContextPath()%>/front/css/css.css" />
	</head>
	<%
		String t = request.getParameter("t") != null ? request
				.getParameter("t") : "1";
		Userinfo userinfo = (Userinfo) CtxSessionBag.getSessionBag()
				.getUserinfo();
	%>
	<body>
		<div id="wrap">
			<jsp:include page="include/top.jsp">
				<jsp:param name="t" value="5" />
			</jsp:include>

			<div id="main" class="mbg clearfix">
				<jsp:include page="include/myDetail-left.jsp">
					<jsp:param name="t" value="3" />
				</jsp:include>
				<div class="fRt rightBar2">
					<div class="breadcrumb">
						您现在的位置：
						<a href="">个人中心</a> > 修改密码
					</div>
					<div class="title">
						<div class="tlText">
							修改密码
						</div>
					</div>
					<form
						action="<%=request.getContextPath() %>/front/myDetail!changepwd.action"
						method="post" id="subForm">
						<div class="editinfo ">
							<p>
								<b>原密码：</b>
								<input type="password" name="opwd" id="password" value="" class="Proinput" />
							</p>
							<p>
								<b>新密码：</b>
								<input type="password" name="npwd" id="newpwd1" value="" class="Proinput" onKeyUp="ps.update(this.value);" />
								6-20个字符（字母、数字、特殊字符）区分大小写。
								<script language="javascript">
						          var ps = new PasswordStrength();
						          ps.setSize("200","20");
						          ps.setMinLength(5);
						        </script>
							<p>
								<b>确认密码：</b>
								<input type="password" name="cnpwd" id="newpwd2" value="" class="Proinput" />
							</p>
							<p>
								<b></b>
								<button class="primary" type="button"
									onclick="javascript:subForm();">
									修改密码
								</button>
							</p>
						</div>
					</form>
				</div>
			</div>
		</div>
		<jsp:include page="include/bottom.jsp" />
		</div>

		<script type="text/javascript">

		var subForm=function(){
		    changepwSubmit();
			document.getElementById('subForm').submit();
		}
		
		function changepwSubmit() 
		{ 
		   var password=document.all("password").value;
		   var newpwd1=document.all("newpwd1").value;
		   var newpwd2=document.all("newpwd2").value;
		   var reg=/\s+/;
		
			if(!password>""){
			   alert("请输入原密码！");
			   pwdForm.password.focus(); 
			   return false; 
			}else if(!(newpwd1.length<=20&&newpwd1.length>=6)){
			   alert("新密码长度不正确：应该是6~20位");
			   pwdForm.newpwd1.focus(); 
			   return false; 
			}else if ( reg.test(newpwd1)){ 
			   alert("新密码不能包含空格"); 
			   pwdForm.newpwd1.focus(); 
			   return false;
			} else if(!newpwd2>""){
			   alert("请再次输入新密码！");
			   pwdForm.newpwd2.focus(); 
			   return false;
			}else if(newpwd1!=newpwd2){
			   alert("新密码不一致！"); 
			   pwdForm.newpwd2.focus(); 
			   return false; 
			}
			else
			{
				return true;
			}
		}

</script>
	</body>
</html>
